package org.hk.kg.finance.coststander.action;

import java.util.List;
import java.util.Map;

import org.hk.kg.db.DBServiceProxy;
import org.hk.kg.finance.coststander.service.CostStanderService;
import org.hk.kg.finance.coststander.service.ICostStanderService;
import org.hk.kg.utils.StringUtils;
import org.hk.kg.web.BaseAction;

public class CostStanderQueryAction extends BaseAction {
	private ICostStanderService costStanderService = DBServiceProxy.getProxyClz(CostStanderService.class);
	
	public String getCostStanders()
	{
		String _nSettedStr = (String) getParams().get("_nSetted");
		List<Map> rlt = null;
		if("true".equalsIgnoreCase(_nSettedStr))
		{
			//查询所有未配置的项目
			logger.debug("查询所有未配置的项目");
			rlt = costStanderService.queryCstStdrNotSetted(getParams());
		}
		else
		{
			rlt = costStanderService.queryCstStdr(getParams());
		}
		StringBuffer html = new StringBuffer();
		for(Map map : rlt)
		{
			html.append("<tr>")
				.append("<td>" + map.get("typeName") + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_one"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_two"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_tree"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_four"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_five"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_six"),0) + "</td>")
				.append("<td>" + StringUtils.decodeEmpty(map.get("stander_seven"),0) + "</td>")
				.append("<tr>");
			
		}
		return html.toString();
	}
}
